package br.com.globalcode.clinicafacil.apresentacao.dentista;

import java.awt.EventQueue;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JToolBar;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;

import br.com.globalcode.clinicafacil.controle.DentistaControler;

public class DentistaFrm extends JFrame {

	private JPanel contentPane;
	private JTextField txtNome;
	private JTextField txtCro;

	private DentistaControler actionListener;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					DentistaFrm frame = new DentistaFrm();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public DentistaFrm() {

		actionListener = new DentistaControler(this);

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);

		JPanel panel = new JPanel();
		panel.setBorder(new TitledBorder(null, "Dentistas",
				TitledBorder.LEADING, TitledBorder.TOP, null, null));

		JToolBar toolBar = new JToolBar();
		GroupLayout ql = new GroupLayout(contentPane);
		ql.setHorizontalGroup(ql
				.createParallelGroup(Alignment.LEADING)
				.addComponent(toolBar, GroupLayout.DEFAULT_SIZE, 424,
						Short.MAX_VALUE)
				.addComponent(panel, Alignment.TRAILING,
						GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE));
		ql.setVerticalGroup(ql.createParallelGroup(Alignment.LEADING).addGroup(
				ql.createSequentialGroup()
						.addComponent(toolBar, GroupLayout.PREFERRED_SIZE, 22,
								GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(ComponentPlacement.UNRELATED)
						.addComponent(panel, GroupLayout.DEFAULT_SIZE, 208,
								Short.MAX_VALUE).addContainerGap()));

		JButton btnSalvar = new JButton("Salvar");
		btnSalvar.addActionListener(actionListener);
		toolBar.add(btnSalvar);

		JButton btnCancelar = new JButton("Cancelar");
		btnCancelar.addActionListener(actionListener);

		toolBar.add(btnCancelar);

		JLabel lblNome = new JLabel("Nome");

		txtNome = new JTextField();
		txtNome.setColumns(10);

		JLabel lblCro = new JLabel("C.R.O");

		txtCro = new JTextField();
		txtCro.setColumns(10);
		GroupLayout gl_panel = new GroupLayout(panel);
		gl_panel.setHorizontalGroup(gl_panel
				.createParallelGroup(Alignment.LEADING)
				.addGroup(
						gl_panel.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										gl_panel.createParallelGroup(
												Alignment.TRAILING)
												.addComponent(lblCro)
												.addComponent(lblNome))
								.addGap(18)
								.addGroup(
										gl_panel.createParallelGroup(
												Alignment.LEADING)
												.addComponent(
														txtCro,
														GroupLayout.PREFERRED_SIZE,
														136,
														GroupLayout.PREFERRED_SIZE)
												.addComponent(
														txtNome,
														GroupLayout.DEFAULT_SIZE,
														344, Short.MAX_VALUE))
								.addContainerGap()));
		gl_panel.setVerticalGroup(gl_panel
				.createParallelGroup(Alignment.LEADING)
				.addGroup(
						gl_panel.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										gl_panel.createParallelGroup(
												Alignment.BASELINE)
												.addComponent(lblNome)
												.addComponent(
														txtNome,
														GroupLayout.PREFERRED_SIZE,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.PREFERRED_SIZE))
								.addGap(18)
								.addGroup(
										gl_panel.createParallelGroup(
												Alignment.BASELINE)
												.addComponent(lblCro)
												.addComponent(
														txtCro,
														GroupLayout.PREFERRED_SIZE,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.PREFERRED_SIZE))
								.addContainerGap(166, Short.MAX_VALUE)));
		panel.setLayout(gl_panel);
		contentPane.setLayout(ql);
	}

	public JTextField getTxtNome() {
		return txtNome;
	}

	
	public void setTxtNome(JTextField txtNome) {
		this.txtNome = txtNome;
	}

	
	public JTextField getTxtCro() {
		return txtCro;
	}

	
	public void setTxtCro(JTextField txtCro) {
		this.txtCro = txtCro;
	}

}
